<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function f1(){
            var divDom=document.querySelector("div");
            //DOM对象.className 获取class的值
            console.log(divDom.className);

            // DOM对象.className=值  重新给class赋值
            divDom.className="b c";
        }
    </script>
</head>
<body>
    <input type="button" value="按钮"  onclick="f1()">
    <div class="a">div</div>
</body>
</html>